package com.twu.biblioteca;

public class Movie {

    String title;
    String director;
    public String rating = "N/A";
    int year, MIN_YEAR = 1900;

    public Movie(String title, int year, String director) throws Exception{
       this.title = title;
       this.year = year;
       this.director = director;

        if(checkIfValid()) {
            throw  new Exception("Invalid details!");
        }
    }

    private boolean checkIfValid() {
        return title.matches("") || year < MIN_YEAR || director.matches("");
    }

    public String changeRating(String new_rating) {
        rating = new_rating;
        return rating;
    }
}
